<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<script src="__JS__/mui.min.js"></script>
    	<link href="__CSS__/mui.min.css" rel="stylesheet"/>
    	<link href="__CSS__/base.css" rel="stylesheet" />
		<link href="__CSS__/myData.css" rel="stylesheet" />
	</head>
	
	<body>
		<div class="bg-share area-center">
			<div class="ewm-area">
				<div class="entry_box">
				<!--list-->
					
				<div class="entry_list phone_entry">
					<input type="number" id="phone" placeholder="请输入手机号"/>
				</div>
				<!--list-->
				<div class="entry_list code_input area-center">
					<input type="number" id="channelNo" placeholder="输入渠道代码" value="{$channelNo}"/>
					<!-- <div class="verification_box">
						<div class="send_button" id="send_button">发送验证码</div>
					</div> -->
				</div>
				<div class="area-center">
					<div class="login_button" id="login_button">确认</div>
				</div>
			</div>
			</div>
		</div>
	</body>
<script type="text/javascript" src="__JS__/filexible_css.js" ></script>
<script type="text/javascript" src="__JS__/flexible.js" ></script>
<script type="text/javascript" src="__PUBLIC__/js/jquery-2.0.3.min.js"></script>
<script>
	mui.init();
	/* $(".login_button").click(function(){
		var phone=$("#phone").val();
		var checkcode=$("#checkcode").val();
		var pid=$("#pid").val();
		if(phone==""){
			mui.alert("请输入手机号码");return false;
		}
		if(checkcode==""){
			mui.alert("请输入验证码");return false;
		}
		$.post("{:U('inviteeRegister')}",{phone:phone,checkcode:checkcode,pid:pid},function(json){
			var data=eval(json);
			mui.alert(data.info);
			if(data.status==1){
				window.location.href=data.url;
			}
			//发送验证码的按钮变成数字
		});
	}); */
	
	/*发送验证码*/
	mui('body').on('tap','.send_button',function(){
		var phone=mui("#phone")[0].value;
	
		mui.get("{:U('sendCheckCode')}",{phone:phone},function(json){
			data=eval(json);
			mui.alert(data.info); 
			
			if(data.status==1){
				//修改按钮
				mui("#send_button")[0].classList.remove("send_button");
				mui("#send_button")[0].classList.add("send_button_out");
				timeshow();
			}
		});
	});
	/*按钮计时器*/
	function timeshow(){
    		var time = 60;//s
    		var start = window.setInterval(function(){
        	time = time - 1;
        	console.log(time);
        	mui("#send_button")[0].classList.add("mui-disabled");
        	mui("#send_button")[0].innerHTML=time;
        	if(time == 0){
            window.clearInterval(start);
            mui("#send_button")[0].classList.remove("send_button_out");
            mui("#send_button")[0].classList.remove("mui-disabled");
            mui("#send_button")[0].classList.add("send_button");
            mui("#send_button")[0].innerHTML="发送验证码";
        	}
    	},1000);
	}
	
	mui("body").on("tap","#login_button",function(){
		var phone=mui("#phone")[0].value;
		//var checkcode=mui("#checkcode")[0].value;
		var channelNo=mui("#channelNo")[0].value;
		if(phone==""){
			mui.alert("请输入手机号码");return false;
		}
		 if(!(/^1[34578]\d{9}$/.test(phone))){
			     mui.alert('请输入正确的手机号');
			     return false;
		 }   

		/* if(checkcode==""){
			mui.alert("请输入验证码");return false;
		} */
		mui.post("{:U('inviteeRegister')}",{phone:phone,channelNo:channelNo},function(json){
			data=eval(json);
			mui.toast(data.info); 
			
			if(data.status==1){
				window.location.href=data.url;
			}
		});
		
	});
</script>
</html>